const express = require('express');
const router = express.Router();
const cors = require('../middlewares/cors');

//? 七牛云上传
const ControllerQiniu = require('../controllers/admin/ControllerQiniu'); //七牛云上传

const ControllerColumn = require('../controllers/web/ControllerHeader');
const ControllerArticle = require('../controllers/web/ControllerArticle');
const ControllerCategory = require('../controllers/web/ControllerCategory');
const ControllerTags = require('../controllers/web/ControllerTags');
const ControllerLink = require('../controllers/web/ControllerLink');
const ControllUser = require('../controllers/web/ControllerUser');
const ControllerTalk = require('../controllers/web/ControllerTalk');
const ControllerAbout = require('../controllers/web/ControllerAbout');

/* GET users listing. */
// router.get('/', function (req, res, next) {
//     res.send('respond with a resource');
// });
//! 七牛云上传
router.get('/qiniu/token', cors.allowAll, ControllerQiniu.uploadToken); // 七牛云上传TOKEN

//! 用户
router.post('/user/login', cors.allowAll, ControllUser.userLogin); // 登录
router.post('/user/register', cors.allowAll, ControllUser.userRegister); // 注册
router.get('/user/detail', cors.allowAll, ControllUser.getById); // 用户详情
router.post('/user/update', cors.allowAll, ControllUser.update); // 用户信息更改
router.put('/user/updatePassword', cors.allowAll, ControllUser.updatePassword); // 修改密码

//! 栏目
router.get('/column/list', cors.allowAll, ControllerColumn.getColumnList); //获取列表

//! 文章
router.get('/article/list', cors.allowAll, ControllerArticle.getList); // 文章列表
router.get('/article/details', cors.allowAll, ControllerArticle.getById); // 文章详情
// router.get('/article/click', cors.allowAll, ControllerArticle.clickRecord); // 纪录点击
router.get('/article/comment/list', cors.allowAll, ControllerArticle.getCommentList); // 评论列表
router.post('/article/comment/add', cors.allowAll, ControllerArticle.InsertComment); // 文章评论
// router.post('/article/reply', cors.allowAll, ControllerArticle.reply); // 文章评论

//! 分类
router.get('/category/list', cors.allowAll, ControllerCategory.getList); // 获取分类列表

//! 标签
router.get('/tag/list', cors.allowAll, ControllerTags.getList); // 获取标签列表

//! 友联
router.get('/link/list', cors.allowAll, ControllerLink.getList); // 获取友联列表
router.get('/link/info', cors.allowAll, ControllerLink.getInfo); // 获取友联说明信息

//! 留言
router.get('/talk/list', cors.allowAll, ControllerTalk.getList); // 留言列表
router.post('/talk/add', cors.allowAll, ControllerTalk.Insert); //添加留言
router.get('/talk/desc', cors.allowAll, ControllerTalk.getDesc); // 留言须知
router.post('/talk/reply', cors.allowAll, ControllerTalk.reply); // 回复

//! 关于
router.get('/about/my', cors.allowAll, ControllerAbout.getMyInfo); // 关于我
router.get('/about/website', cors.allowAll, ControllerAbout.getWebsiteInfo); // 关于网站


module.exports = router;
